class Shop {
  Seller seller;
  List<Goods> goods;
  List<Ratings> ratings;

  Shop({this.seller, this.goods, this.ratings});

  Shop.fromJson(Map<String, dynamic> json) {
    seller =
        json['seller'] != null ? new Seller.fromJson(json['seller']) : null;
    if (json['goods'] != null) {
      goods = new List<Goods>();
      json['goods'].forEach((v) {
        goods.add(new Goods.fromJson(v));
      });
    }
    if (json['ratings'] != null) {
      ratings = new List<Ratings>();
      json['ratings'].forEach((v) {
        ratings.add(new Ratings.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.seller != null) {
      data['seller'] = this.seller.toJson();
    }
    if (this.goods != null) {
      data['goods'] = this.goods.map((v) => v.toJson()).toList();
    }
    if (this.ratings != null) {
      data['ratings'] = this.ratings.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Seller {
  String name;
  String description;
  int deliveryTime;
  double score;
  double serviceScore;
  double foodScore;
  double rankRate;
  int minPrice;
  int deliveryPrice;
  int ratingCount;
  int sellCount;
  String bulletin;
  List<Supports> supports;
  String avatar;
  List<String> pics;
  List<String> infos;

  Seller(
      {this.name,
      this.description,
      this.deliveryTime,
      this.score,
      this.serviceScore,
      this.foodScore,
      this.rankRate,
      this.minPrice,
      this.deliveryPrice,
      this.ratingCount,
      this.sellCount,
      this.bulletin,
      this.supports,
      this.avatar,
      this.pics,
      this.infos});

  Seller.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    description = json['description'];
    deliveryTime = json['deliveryTime'];
    score = json['score'];
    serviceScore = json['serviceScore'];
    foodScore = json['foodScore'];
    rankRate = json['rankRate'];
    minPrice = json['minPrice'];
    deliveryPrice = json['deliveryPrice'];
    ratingCount = json['ratingCount'];
    sellCount = json['sellCount'];
    bulletin = json['bulletin'];
    if (json['supports'] != null) {
      supports = new List<Supports>();
      json['supports'].forEach((v) {
        supports.add(new Supports.fromJson(v));
      });
    }
    avatar = json['avatar'];
    pics = json['pics'].cast<String>();
    infos = json['infos'].cast<String>();
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['description'] = this.description;
    data['deliveryTime'] = this.deliveryTime;
    data['score'] = this.score;
    data['serviceScore'] = this.serviceScore;
    data['foodScore'] = this.foodScore;
    data['rankRate'] = this.rankRate;
    data['minPrice'] = this.minPrice;
    data['deliveryPrice'] = this.deliveryPrice;
    data['ratingCount'] = this.ratingCount;
    data['sellCount'] = this.sellCount;
    data['bulletin'] = this.bulletin;
    if (this.supports != null) {
      data['supports'] = this.supports.map((v) => v.toJson()).toList();
    }
    data['avatar'] = this.avatar;
    data['pics'] = this.pics;
    data['infos'] = this.infos;
    return data;
  }
}

class Supports {
  int type;
  String description;

  Supports({this.type, this.description});

  Supports.fromJson(Map<String, dynamic> json) {
    type = json['type'];
    description = json['description'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['type'] = this.type;
    data['description'] = this.description;
    return data;
  }
}

class Goods {
  String name;
  int type;
  List<Foods> foods;

  Goods({this.name, this.type, this.foods});

  Goods.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    type = json['type'];
    if (json['foods'] != null) {
      foods = new List<Foods>();
      json['foods'].forEach((v) {
        foods.add(new Foods.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['type'] = this.type;
    if (this.foods != null) {
      data['foods'] = this.foods.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Foods {
  String name;
  int price;
  int oldPrice;
  String description;
  int sellCount;
  int rating;
  String info;
  List<Ratings> ratings;
  String icon;
  String image;
  Goods goods;

  Foods(
      {this.name,
      this.price,
      this.oldPrice,
      this.description,
      this.sellCount,
      this.rating,
      this.info,
      this.ratings,
      this.icon,
      this.image});

  Foods.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    price = json['price'];
    oldPrice = json['oldPrice'];
    description = json['description'];
    sellCount = json['sellCount'];
    rating = json['rating'];
    info = json['info'];
    if (json['ratings'] != null) {
      ratings = new List<Ratings>();
      json['ratings'].forEach((v) {
        ratings.add(new Ratings.fromJson(v));
      });
    }
    icon = json['icon'];
    image = json['image'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['price'] = this.price;
    data['oldPrice'] = this.oldPrice;
    data['description'] = this.description;
    data['sellCount'] = this.sellCount;
    data['rating'] = this.rating;
    data['info'] = this.info;
    if (this.ratings != null) {
      data['ratings'] = this.ratings.map((v) => v.toJson()).toList();
    }
    data['icon'] = this.icon;
    data['image'] = this.image;
    return data;
  }
}

class Ratings {
  String username;
  int rateTime;
  int deliveryTime;
  num score;
  int rateType;
  String text;
  String avatar;
  List<String> recommend;

  Ratings(
      {this.username,
      this.rateTime,
      this.deliveryTime,
      this.score,
      this.rateType,
      this.text,
      this.avatar,
      this.recommend});

  Ratings.fromJson(Map<String, dynamic> json) {
    username = json['username'];
    rateTime = json['rateTime'];
    deliveryTime = json['deliveryTime'];
    score = json['score'];
    rateType = json['rateType'];
    text = json['text'];
    avatar = json['avatar'];
    if (json['recommend'] != null) {
      recommend = json['recommend'].cast<String>();
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['username'] = this.username;
    data['rateTime'] = this.rateTime;
    data['deliveryTime'] = this.deliveryTime;
    data['score'] = this.score;
    data['rateType'] = this.rateType;
    data['text'] = this.text;
    data['avatar'] = this.avatar;
    if (this.recommend != null) {
      data['ratings'] = this.recommend.toList();
    }
    return data;
  }
}
